package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {

    /**
     * @description: 批量插入口味数据
     * @author: zhouzhijie
     * @date: 2023/11/13 17:28
     * @param: [flavors]
     * @return:
     **/
    void insertBatch(List<DishFlavor> flavors);

    /**
     * @param dishIds
     * @description: 根据菜品ids批量删除口味数据
     * @author: zhouzhijie
     * @date: 2023/11/15 15:41
     * @param: [ids]
     * @return:
     */
    void deleteBatchByDishIds(List<Long> dishIds);

    /**
     * @description: 根据菜品id查询对应的口味信息
     * @author: zhouzhijie
     * @date: 2023/11/15 23:06
     * @param: [id]
     * @return:
     **/
    @Select("select * from dish_flavor where dish_id = #{dishId}")
    List<DishFlavor> getByDishId(Long dishId);

    /**
     * @description: 根据菜品id删除口味数据
     * @author: zhouzhijie
     * @date: 2023/11/16 18:22
     * @param: [id]
     * @return: 
     **/
    @Delete("delete from dish_flavor where dish_id = #{dishId}")
    void deleteByDishId(Long dishId);
}
